package com.example.yang.yixin.FragmentManager;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import com.example.yang.yixin.R;
import com.example.yang.yixin.Views.AnnularView;

public class Fragment_phonecontrol extends Fragment {
 Button button;
private Float[] datas = new Float[3];
AnnularView annularView1;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
       View view=inflater.inflate(R.layout.fragment_phonecontrol,container,false);
        annularView1=view.findViewById(R.id.view_phonecontrol);
        button=view.findViewById(R.id.detail);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Bundle bundle=new Bundle();
                bundle.putString("bkpassword",getArguments().getString("bkpassword"));
              Fragment_controldetail fragment_controldetail=new Fragment_controldetail();
                fragment_controldetail.setArguments(bundle);
                getFragmentManager().beginTransaction().replace(R.id.Fr_container,fragment_controldetail).commit();
            }
        });
        Init();
        return view;
    }

    private void Init() {
        float one=Float.valueOf(getArguments().getString("controlmost"));
        float two=Float.valueOf(getArguments().getString("controlonetothree"));
        float three=Float.valueOf(getArguments().getString("controlother"));
        datas[0]=one;
        datas[1]=three;
        datas[2]=two;
        Log.d("controlmost",one+"");
        Log.d("controlonetothree",two+"");
        Log.d("controlother",three+"");
        annularView1.setDatas(datas,true);
    }
}
